﻿@model Coevery.Fields.Fields.CoeveryTextField
@using Orchard.Utility.Extensions;
@using Coevery.Fields.Settings;
@{
    var settings = Model.PartFieldDefinition.Settings.GetModel<CoeveryTextFieldSettings>();
    var required = settings.Required ? "required" : null;
}

<label class="title control-label @required" for="@Html.FieldIdFor(m => m.Value)">@Model.DisplayName</label>

<div class="control controls errortips">
    <input class="span12"  type="text" id="@Html.FieldIdFor(m => m.Value)" name="@Html.FieldNameFor(m => m.Value)" value="@Model.Value" @if (required != null) {<text>required data-msg-required="This field is required."</text>} @if (settings.MaxLength > 1) {<text> maxlength="@settings.MaxLength"</text>} placeholder="@settings.PlaceHolderText" 
        @if (!string.IsNullOrWhiteSpace(settings.HelpText)){<text>helper:text='@settings.HelpText'</text> }  />
    @Html.ValidationMessageFor(m => m.Value)
</div>